package com.ymt.order.dao.impl;

import com.ymt.order.dao.OrderMapper;
import com.ymt.producer.domain.Order;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class OrderMapperImpl implements OrderMapper {
    private static final String INSERT = "com.ymt.producer.dao.OrderMapper.insert";
    private static final String COUNTBYORDERCODE = "com.ymt.producer.dao.OrderMapper.countByOrderCode";

    @Autowired
    private SqlSessionTemplate sqlSession;

    @Override
    public Integer insert(Order order) {
        return this.sqlSession.insert(INSERT, order);
    }

    @Override
    public Long countByOrderCode(String orderCode) {
        return this.sqlSession.selectOne(COUNTBYORDERCODE,orderCode);
    }
}
